const express = require("express");
const app = express();
const logger = require("../_unit/logs");

app.get("/a", (request, response) => {
  logger.info(request, "request");
  logger.info(response, "response");
  response.setHeader("Content-Type", "text/html; charset=utf-8");
  response.end("<h1>a路由 -- get请求</h1>");
});

app.post("/b", (request, response) => {
  response.setHeader("Content-Type", "text/html; charset=utf-8");
  response.end("<h1>b路由 -- post请求</h1>");
});

app.all("/c", (request, response) => {
  response.setHeader("Content-Type", "text/html; charset=utf-8");
  response.end("<h1>c路由 -- all请求</h1>");
});

app.all("*", (request, response) => {
  response.setHeader("Content-Type", "text/html; charset=utf-8");
  response.end("<h1>*路由 -- all请求 </h1>");
});

app.listen(3000, () => {
  console.log("启动3000端口...");
});
